package com.weixing.mall.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weixing.mall.provider.mapper.AgentDiscountMapper;
import com.weixing.mall.provider.model.domain.AgentDiscount;
import com.weixing.mall.provider.api.model.vo.AgentDiscountVo;
import com.weixing.mall.provider.service.IAgentDiscountService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 促销模块-代理商活动折扣表 服务实现类
 * </p>
 *
 * @author Small
 * @since 2019-11-16
 */
@Service
public class AgentDiscountServiceImpl extends ServiceImpl<AgentDiscountMapper, AgentDiscount> implements IAgentDiscountService {


    @Override
    public List<AgentDiscountVo> getByName(String name) {
        return baseMapper.getByName(name);
    }

    @Override
    public IPage<AgentDiscountVo> listPage(Page page, String name) {
        return baseMapper.listPage(page,name);
    }

    @Override
    public AgentDiscount selectByName(String name) {
        return getOne(new QueryWrapper<AgentDiscount>().eq("rule_name",name));
    }
}
